#include "uart.h"
#include "lib.h"
#include "page.h"
#include "task.h"
#include "hwirq.h"
#include "timer.h"

#define ASCII \
"  _____ _______     _______      ______   _____ \n" \
" |  __ \\__   __|   |  __ \\ \\    / / __ \\ / ____|\n" \
" | |__) | | |______| |__) \\ \\  / / |  | | (___  \n" \
" |  _  /  | |______|  _  / \\ \\/ /| |  | |\\___ \\ \n" \
" | | \\ \\  | |      | | \\ \\  \\  / | |__| |____) |\n" \
" |_|  \\_\\ |_|      |_|  \\_\\  \\/   \\____/|_____/ \n"



extern void user_task0(void);
extern void user_task1(void);
extern inline void enable_global_interrupt();
extern inline void enable_msoft_interrupt();

void start_kernel()
{

	uart_init();
	mprintf(ASCII);
	page_init();

	plic_init();
	timer_init();
	enable_msoft_interrupt();
	enable_global_interrupt();

	sched_init();
	task_create(user_task0);
	task_create(user_task1);
	schedule();



	mprintf("not comimg here\n");
	while(1);
}
